/***************************************************************************
 *   Copyright (C) 2005 by xihe   *
 *   xihels@163.com                                                        *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef _QQ_USER_H_
#define _QQ_USER_H_
#include <stdint.h>
#include <string>
using std::string;

#include "QQ.h"
class QQUser;


class QQUser {
    public:
	QQUser();
	~QQUser();

	QQUser(const QQUser& rhs);
	QQUser& operator = (const  QQUser& rhs);

	uint32_t getUid()	  const	{ return uid; }
	uint8_t getLoginMode()	  const	{ return loginMode; }
	const uint8_t* getPwkey() const { return pwkey; }
	const string& getServer() const { return server; }
	uint16_t getPort()	  const	{ return port; }
	bool isTcp()		  const	{ return tcp; }
	bool isFakeCam()	  const	{ return fakeCam; }
	bool isRememberPassword() const { return rememberPassword; }

	void setTcp(bool tcp_)		{ tcp = tcp_; }
	void setUid(uint32_t uid_)	{ uid = uid_; }
	void setLoginMode(uint8_t mode) { loginMode = mode; }
	void setServer(const string ip) { server = ip; }
	void setFakeCam(bool fake)	{ fakeCam = fake; }
	void setRememberPassword( bool remember) { rememberPassword = remember; }
	void setPort(const uint16_t _port)  { port = _port; }
	void setPassed(const string passwd) { genPwkey(passwd.c_str(), pwkey); }
	void setPwkey(const uint8_t* _pwkey);

    private:
	static void genPwkey(const char* pwd,  uint8_t* const pwkey);

	uint32_t uid;			 //QQ号码
	string	 server;		 //QQ服务器ip
	uint16_t port;			 //QQ服务器port

	uint8_t  pwkey[QQ_KEY_LENGTH];   //用户密码的2次md5加密
	uint8_t	 loginMode;		 //登录模式
	bool	 tcp;			 //是否用tcp方式登录
	bool	 fakeCam;		 //是否显示虚拟摄像头
	bool	 rememberPassword;	 //是否保存密码

};

#endif // _QQ_USER_H_

